#==============================================
#	HGSC Libraries
#==============================================

# This makes sure that libhgsc is up-to-date. libhgsc is a 
# set of libraries that are HGSC specific somehow.  This may 
# be because they use HGSC specific 3rd party libraries (e.g. Oracle),
# they are aware of HGSC specific formats (e.g. Scaffold graphs)
# etc. 
# 
_hgsclib:
	cd $(HGSC_DEVEL_DIR); make all

_hgsclibg:
	cd $(HGSC_DEVEL_DIR); make bug

_hgsclibpg: 
	cd $(HGSC_DEVEL_DIR); make prof


# Oracle linking is so tediously long, that I have decided to always 
# do "make kjd-someprogram.oracle" to specify that oracle compiling is required.
%.goracle: %.cc _cbtlibg _glocallib
	$(GCC) $(CCFLAGS) -g $(INCLUDES_CC) $(ORACLE_INCLUDES) -c -o $(CBT_DEVEL_LIB)/$*.g.o $*.cc 
	$(GCC) -o $*.goracle $(LIB_PATHS) $(CBT_DEVEL_LIB)/$*.g.o $(glocalobjs) $(HGSCORACLE) $(CBT_DEVEL_LIB)/libcbt.g.a -lhgsc -lstdc++ -lm -lgzstream -lz -lboost_regex -lhgscoracle
	cp -f $*.goracle $(CBT_DEVEL_BIN)
	rm -f $*.goracle

# Link with oracle and use stlport stl with debugging.  
%.stlportoracle: %.cc _stlportlib _stlportlocallib _hgsclib 
	$(GCC) $(CCFLAGS) -D_STLP_DEBUG -g $(INCLUDES_STLPORT) $(ORACLE_INCLUDES) -c -o $(CBT_DEVEL_LIB)/$*.stlport.o $*.cc 
	$(GCC) -o $*.stlport $(LIB_PATHS) $(CBT_DEVEL_LIB)/$*.stlport.o $(stlportglocalobjs) $(HGSCORACLE) $(CBT_DEVEL_LIB)/libcbt.stlport.a -lhgsc -lstdc++ -lm -lgzstream -lz -lboost_regex -lhgscoracle
	cp -f $*.stlport $(CBT_DEVEL_BIN)
	rm -f $*.stlport


# Oracle linking is so tediously long, that I have decided to always 
# do "make kjd-someprogram.oracle" to specify that oracle compiling is required.
%.oracle: %.cc _cbtlib _locallib
	$(GCC) $(CCFLAGS) -O3 $(INCLUDES_CC) $(ORACLE_INCLUDES) -c -o $(CBT_DEVEL_LIB)/$*.o $*.cc 
	$(GCC) -o $* $(LIB_PATHS) $(CBT_DEVEL_LIB)/$*.o $(localobjs) $(HGSCORACLE) $(CBT_DEVEL_LIB)/libcbt.a -lhgsc -lstdc++ -lm -lz -lboost_regex -lhgscoracle
	cp -f $* $(CBT_DEVEL_BIN)
	rm -f $*
